1. Field of Invention
The present invention generally relates to a queue, and more particularly, to a message transmitting queue and the method of operating the same.
2. Description of Related Art
In the system with dual processors, in order to achieve the objective of transmitting a message from one to the other, a message transmitting queue is commonly used as a bridge in between. However, if the message transmitting queue, for example, uses the general serial queue that only has the write pointer and the read pointer, although this may be okay for the single task system, a message misplacement or overlap may occur in the multi-threaded system. Since the size of the transmitted message between the processors may exceed the atomic data read/write size of the processor, the message is actually transmitted to the queue by several times. Moreover, the write pointer cannot move until the message writing completes. Therefore, in the multi-threaded system, when a process does not complete writing the message, the other process may complete writing the message at this time point in advance. So, the previous message is overlapped. When the write pointer moves, the message that does not complete the writing operation is then written by the previous process, thus causing message misplacement. Such a circumstance can be prevented by using the semaphore. However, this will introduce a complicated software operation and impact the system performance.